<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <ui:composition template="/WEB-INF/faces/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{msgs.CreateUserTitle}"></h:outputText>
        </ui:define>
        <ui:define name="content">
            <h:panelGroup id="messagePanel" layout="block">
                <p:growl sticky="true"/>              
            </h:panelGroup>
            <p:panel header="Add User" style="border: none;">
                <h:form>
                    <h:panelGrid id="entryPanel" columns="3">
                        <h:outputLabel value="User ID" for="loginId" />
                        <h:inputText id="loginId" value="#{userBean.selected.loginId}" requiredMessage="* Required" required="true"/>
                        <p:message for="loginId" />
                        <h:outputLabel value="Name" for="fullName" />
                        <h:inputText id="fullName" value="#{userBean.selected.fullName}" requiredMessage="* Required" required="true"/>
                        <p:message for="fullName" />
                        <h:outputLabel value="Password" for="passwd" />
                        <p:password id="passwd" value="#{userBean.selected.password}" minLength="6" requiredMessage="* Required" required="true"/>
                        <p:message for="passwd" />
                        <h:outputLabel value="User Type" for="role" />
                        <h:selectOneMenu id="role" value="#{userBean.selected.role}" required="true" requiredMessage="* Required">
                            <f:selectItems value="#{userBean.roles}" />
                        </h:selectOneMenu>
                        <p:message for="role" />
                        <h:outputLabel value="Email" for="emailId" />
                        <h:inputText id="emailId" value="#{userBean.selected.emailId}" title="#{msgs.EditUserTitle_emailId}" />
                        <p:message for="emailId" />
                        <h:outputLabel value="Phone" for="contactNo" />
                        <h:inputText id="contactNo" value="#{userBean.selected.contactNo}" title="#{msgs.EditUserTitle_contactNo}" />
                        <p:message for="contactNo" />
                    </h:panelGrid>

                    <br/>
                    <p:commandButton action="#{userBean.create}" value="Save" update="entryPanel"/>

                    <p:commandButton action="#{userBean.prepareList}" value="Cancel" immediate="true"/>

                </h:form>
            </p:panel>
        </ui:define>
    </ui:composition>

</html>
